package com.copa.module.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.copa.module.user.domain.entity.UserEntity;
import com.copa.module.user.domain.vo.UserListVo;
import com.copa.module.user.domain.vo.UserUpdateVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author copa
 * @createDate 2021-01-05 8:44
 * @function
 */
@Mapper
@Repository
public interface UserDao extends BaseMapper<UserEntity> {

    UserEntity findByUsername(@Param("username") String username);

    @Select("SELECT id,username,actual_name,open_id,avatar_url,gender,phone,id_card,birthday,email,is_enabled,remark,create_time,update_time,is_delete " +
            "FROM t_user")
    List<UserEntity> listUser();

    IPage<UserEntity> findUserListByUserListVo(@Param("page") Page<UserEntity> page, @Param("userListVo") UserListVo userListVo);

    Boolean updateIsEnableByUserId(@Param("userUpdateVo") UserUpdateVo userUpdateVo);
}
